<?php $this->_extends('_layouts/ashop_layout'); ?>
<?php $this->_block('title'); ?> <?=$store['name']?> <?php $this->_endblock(); ?>
<?php $this->_block('contents'); ?>
<form action="" method="post" target="_blank_cart">
	<?php if(isset($error)&&count($error)):?>
	<div> 
		<?php foreach($error as $e=>$v):
			switch($e){
				case '': echo ''; break;
			}
		 endforeach;?>
	</div>
	<?php endif;?>
	<div class="">
		<h3>Shipping Address</h3>
		<div>
			<span class="inputLabel">Email:</span> <input type="text" name="email" value="<?=$cart['ship']['email']?>" size="40" />  <span class="alert">*</span><br />
			<span class="inputLabel">&nbsp;</span> <input type="radio" name="gender" value="m" <?php if($cart['ship']['gender']=='m'){echo 'checked=true';}?> />Mr  &nbsp;&nbsp; <input type="radio" name="gender" value="f" <?php if($cart['ship']['gender']=='f'){echo 'checked=true';}?> />Ms  <br />
			<span class="inputLabel">First Name:</span> <input type="text" name="firstname" value="<?=$cart['ship']['firstname']?>" size="20" />  <span class="alert">*</span><br />
			<span class="inputLabel">Last Name:</span> <input type="text" name="lastname" value="<?=$cart['ship']['lastname']?>" size="20" />  <span class="alert">*</span><br />
			<span class="inputLabel">Company Name:</span> <input type="text" name="company" value="<?=$cart['ship']['company']?>" size="40" />  <br />
			<span class="inputLabel">Phone:</span> <input type="text" name="phone" value="<?=$cart['ship']['phone']?>" size="20" />  <span class="alert">*</span><br />
			<span class="inputLabel">Street Address:</span> <input type="text" name="street1" value="<?=$cart['ship']['street1']?>" size="40" />  <span class="alert">*</span><br />
			<span class="inputLabel">Address Line 2:</span> <input type="text" name="street2" value="<?=$cart['ship']['street2']?>" size="40" /> <br />
			<span class="inputLabel">City:</span> <input type="text" name="cityname" value="<?=$cart['ship']['cityname']?>" size="20" />  <br />
			<span class="inputLabel">State/Province:</span> <input type="text" name="stateorprovince" value="<?=$cart['ship']['stateorprovince']?>" size="20" />  <br />
			<span class="inputLabel">Post/Zip Code:</span> <input type="text" name="postalcode" value="<?=$cart['ship']['postalcode']?>" size="10" />  <span class="alert">*</span><br />
			<span class="inputLabel">Country:</span> <?php Q::control('dropdownlist','country',array(
        "items"=>$country_array,
        'value'=>$cart['ship']['country']
    ))->display()?> <span class="alert">*</span><br />
		</div>
	</div>
	
	<div class="">
		<h3>Shipping method</h3>
		<div>
			<ul>
				<?php if(count($shipments)) foreach($shipments as $shipment):?>
				<li><input type="radio" name="shipment" value="<?=$shipment->shipment_id?>"   /> <?=$shipment->shipment->title?></li>
				<?php endforeach;?>
			</ul>
		</div>
	</div>
	
	<div class="">
		<h3>Pay method</h3>
		<div> select currency <?php Q::control('dropdownlist','currency',array(
        "items"=>array('USD'),
        'value'=>$cart['currency']
    ))->display()?></div>
		<div>
			<ul>
				<?php if(count($payments)) foreach($payments as $payment):?>
				<li><input type="radio" name="payment" value="<?=$payment->payment_id?>"  /> <?=$payment->payment->title?></li>
				<?php endforeach;?>
			</ul>
		</div>
	</div>
	
	<div class="goodinfo">
		<table>
		<tr>
			<td height="0" width="100"></td><td></td>
		</tr>
		<?php $amount=0;
			foreach($goods as $g):
				$sg=$cart['goods'][$g->goods_id];
				$q=$sg['quantity'];
				$total=$q*$g->price;
				$amount+=$total;
		?>
			<tr>
				<td><a href="<?=url('default/product',array('goods_id'=>$g->goods_id))?>" ><img src="<?=$g->imgurl?>" /></a></td>
				<td>
				<a href="<?=url('default/product',array('goods_id'=>$g->goods_id))?>" ><?=$g->title?></a>
				</td>
				<td><span class="price"> <?=$g->price.' '.$g->currency?> </span></td>
				<td><span class="price"><?=$sg['quantity']?></span></td>
				<td><span class="price"> <?=$total.' '.$g->currency?> </span></td>
				<td></td>
			<tr>
		<?php endforeach;?>
			<tr>
				<td colspan="3"></td>
				<td><?=$amount?></td>
			</tr>
		</table>
	</div>
	<div style="clear:both"></div>
	<div>
		<input type="button" value="return" onclick=""  />
		<input type="submit" value="   checkout   " />
	</div>
	
</form>	
<?php $this->_endblock('contents'); ?>
